package com.tradeplus.admin.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.tradeplus.admin.model.Education;

public class EducationDaoImpl implements EducationDao {
	
	private HibernateTemplate hibernateTemplate;

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }

	@Override
	public void saveEducation(Education education) {
		hibernateTemplate.merge(education);
	}

	@Override
	public List<Education> loadEducation() {
		return hibernateTemplate.find("from Education");
	}

	@Override
	public Education loadEducationById(Long educationId) {
		return hibernateTemplate.get(Education.class, educationId);
	}

	@Override
	public void deleteEducation(Long educationId) {
		hibernateTemplate.delete(hibernateTemplate.get(Education.class, educationId));
	}

}
